package com.xxgc.spring.converter;

import org.springframework.core.convert.converter.Converter;

import java.util.Date;
//自定义类型转换器
public class DateConverter implements Converter<String,Date> {
    public Date convert(String s) {
        System.out.println("进入类型转换器"+s);
        if(s == null){
            throw new RuntimeException("没有传入参数");
        }
        long longs = Long.parseLong(s);
        Date date = new Date();
        date.setTime(longs);

        return date;
    }
}
